home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Original Shareware 1.1
/
The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso
/
24
/
mset.zip
/
MSET.8
next >
Wrap
Text File
|
1987-09-10
|
2KB
|
44 lines
;MSET.COM sets video mode.
mov si,80h ;Point to command line
mov ax,0 ;Init old total on stack
push ax
lodsb ;Get # chars
mov cl,al ;to cl
mov ch,0
X0: lodsb ;Skip spaces
cmp al,' ' ;= space?
jne X1 ;No
loop X0 ;Yes, skip them
X1:
cmp cl,0 ;Any parameter?
je Error ;No
dec si ;Yes, point to first char
X2: lodsb ;Get a char
cmp al,13 ;Is a carriage return?
je X3 ;Yes
sub al,'0' ;Convert to number
cmp al,0 ;<0?
jb Error ;Yes
cmp al,9 ;>9?
ja Error ;Yes
mov bl,al ;Save in bl
pop ax ;Get old total
mov ah,10 ;x 10
mul ah
add al,bl ;Add new value
push ax ;Save new total
loop X2 ;Keep going until cr
X3: pop ax ;Get total
cmp al,16 ;>16?
ja Error ;Yes
mov ah,0 ;Set mode
int 10h ;thru BIOS
X4: int 20h ;and quit
Msg: db 'Format is: mset mode where mode = 0 to 16',13,10,'$'
Error:
mov dx,Msg ;Point to error message
mov ah,9 ;Print to screen
int 21h ;thru DOS
jmp X4 ;and quit